/**
 * Copyright (c) 2015-2017, Henry Yang 杨勇 (gismail@foxmail.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.lambkit.module.cms.rpc.api;

import java.util.List;

import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.lambkit.common.service.LambkitService;
import com.lambkit.module.cms.core.layer.MenuTree;
import com.lambkit.module.cms.rpc.model.CmsCategory;

/**
 * @author yangyong 
 * @website: www.lambkit.com
 * @email: gismail@foxmail.com
 * @date 2019-10-22
 * @version 1.0
 * @since 1.0
 */
public interface CmsCategoryService extends LambkitService<CmsCategory> {

	/**
	 * 系统的分类
	 * @param systemId
	 * @return
	 */
	List<CmsCategory> findListBySystemId(Long systemId, Long userId);
	
	/**
	 * 树结构分类信息
	 * @param systemId
	 * @return
	 */
	List<CmsCategory> treeBySystemId(Long systemId, Long userId);
	
	/**
	 * 树结构分类信息,用于layui
	 * @param systemId
	 * @return
	 */
	List<MenuTree> menuTreeBySystemId(Long systemId, Long userId, int layer);
	
	/**
	 * 树结构分类信息,用于layui
	 * @param systemId
	 * @return
	 */
	List<MenuTree> menuTreeByParentid(Long categoryId, Long userId, int layer);

	/**
	 * 该文章的所有分类
	 * @param articleId
	 * @return
	 */
	List<CmsCategory> findCategoryListByArticleId(Long articleId);

	/**
	 * 标识的分类
	 * @param flag
	 * @return
	 */
	CmsCategory findFirstByFlag(String flag, Long userId);

	/**
	 * 所有子分类以及子类的子类
	 * @param categoryId
	 * @return
	 */
	List<CmsCategory> findAllChildById(Long categoryId, Long userId);
	
	/**
	 * 所有子分类，仅一层
	 * @param categoryId
	 * @return
	 */
	List<CmsCategory> findByParenId(Long parentId, Long userId);
	
	/**
	 * 该分类及其所有子分类的tree
	 * @param categoryId
	 * @return
	 */
	CmsCategory treeById(Long categoryId, Long userId);
	/**
	 * 所有子分类的tree
	 * @param parentId
	 * @param userId
	 * @return
	 */
	List<CmsCategory> treeByParenId(Long parentId, Long userId);
	
	/**
	 * 分类地址链
	 * @return
	 */
	List<CmsCategory> linkParentById(Long categoryId);
	/**
	 * 获取该目录所有文件和文件夹
	 * @param id
	 * @return
	 */
	List<Record> getAll(Long categoryId, Long userId, Long systemId);
	/**
	 * 获取该目录所有文件
	 * @param id
	 * @return
	 */
	List<Record> getAllFile(Long categoryId, Long userId);
	/**
	 * 获取两个分类的数据
	 * @param pageNumber
	 * @param pageSize
	 * @param categoryId1， file分类
	 * @param categoryId2，article分类
	 * @return
	 */
	Page<Record> getFileAndNote(int pageNumber, int pageSize, Long categoryId1, Long categoryId2, Long userId);
	/**
	 * 移除目录，但不删除，不建议删除
	 * @param id
	 * @return
	 */
	int remove(String ids, Long userId);
	/**
	 * 移动ids目录列表到pid目录
	 * @param pid
	 * @param ids
	 * @return
	 */
	int move(Long pid, String ids, Long userId);
}
